package com.phx.serialjni;

import android.graphics.Rect;

import java.util.HashMap;
import java.util.Map;

public class PageS {
    static int pageno ;
    static int pageback ;

    static Integer[] nodeArray;

   // static String[][]  sliderCmd = new String[3][10];
//   static String[][]  sliderCmd ={{"1D1200009", "1C1E00009", "17161000E", "1B161000E", "1C1E00009", "17161000E", "1B161000E", "1C1E00009", "17161000E", "1B161000E",},
//            {"2D1200009", "2C1E00009", "27161000E", "2B161000E", "2C1E00009", "27161000E", "2B161000E", "2C1E00009", "27161000E", "2B161000E",},
//            {"3D1200009", "3C1E00009", "37161000E", "3B161000E", "3C1E00009", "37161000E", "3B161000E", "3C1E00009", "37161000E", "3B161000E"}};
    static String[][]  sliderCmd ={{"71B00009", "71B10009", "7161000E", "B161000E", "C1E00009", "7161000E", "B161000E", "C1E00009", "7161000E", "B161000E",},
            {"72B00009", "C1E00009", "7161000E", "B161000E", "C1E00009", "7161000E", "B161000E", "C1E00009", "7161000E", "B161000E",},
            {"73B00009", "C1E00009", "7161000E", "B161000E", "C1E00009", "7161000E", "B161000E", "C1E00009", "7161000E", "B161000E",},
           {"74B00009", "C1E00009", "7161000E", "B161000E", "C1E00009", "7161000E", "B161000E", "C1E00009", "7161000E", "B161000E",}};
   static String[] allDArray = new String[]{"0071", "0072", "0073", "0074","0081", "0082", "0083", "0084",
           "1010","1011","71b0","72b0","73b0","74b0"};

    //static String[] allDArray = new String[]{"0071", "0072", "0073", "0074","0075","0076",
    // "0081", "0082", "0083", "0084","0085","0086","0087","1010","1011","71b0","72b0","73b0"};
    static String[] voladdress = {"1010","1011"};
    Integer[] resArray ;
    Integer[] seqArray ;
    static Integer[] offArray ;

    static Integer[] onArray ;

    static String[] cmdArray  ;
    static  Integer[] typeArray;
    static String[] feedDArray;

     int mleft = 1204;
             int mtop = 600;
             int mwidth = 144;
             int mheight = 145;
         static int jmpPosition = 0;
 static Rect[]  allRect;
 // static  HashMap feedmap = new HashMap();
// public static   Map<String,String> feedmap=new HashMap<String,String>()
// {
//     put("00d1","0001") {
//
//     }
// };

// for (Entry<String, String> entry : map.entrySet()) {
//     String key = entry.getKey();
//     String value = entry.getValue();
//     System.out.println(key + "," + value); }

//    Map<String, String> myMap = new HashMap<String, String>() {
//        {
//            put("00d1", "0000");
//            put("00c1", "0000");
//        }
//    };


   public  static HashMap<String, String> feedMap = new HashMap<String, String>();
    public  static HashMap<String, String> feedType = new HashMap<String, String>();



    // feedmap.put();
    // feedmap.Entry
      //feedmap.put("b", "bbb");
      //      map.put("c", "ccc");
      //      map.put("d", "ddd");
    // Rect curRect;
    // Rect touchRect;

//    int mleft = 1204;
//    int mtop = 600;
//    int mwidth = 144;
//    int mheight = 145;
//
//    Rect curRect = new Rect(mleft, mtop, mwidth, mheight);
//    Rect touchRect = new Rect(mleft, mtop, mwidth, mheight);
//
//    var pageImgs:[String] = ["1.jpg","2.jpg","3.jpg","4.jpg","5.jpg","6.jpg","6.jpg","e.jpg","e1.jpg","e3.jpg","g1.jpg","g2.jpg","g3.jpg","e4.jpg","g4.jpg","g5.jpg"]
//
//    var curIndexs:[Int] = [0,1,2,3,4,5,6,7,8,9,10,11,12]
//    var judIndexs0:[Int] = [0,1,2,3,4,5] //5
//
//    var judIndexs1:[Int] = [2,1,16,16,16,16,16,16,16,16,16,16,16,16,16]   //14
//    var judIndexs11:[Int] = [1,3,7,4,10]
//
//    var judIndexs2:[Int] = [16,16,16,16,16,16,16]   //14
//    var judIndexs21:[Int] = [1,3,7,4,10]
//
//    var judIndexs3:[Int] = [2,1,16,16,16,16,16,16,16,16,16,16,16,16,16]   //14
//    var judIndexs31:[Int] = [1,3,7,4,10]
//
//    var judIndexs4:[Int] = [2,1,16,16,16,16,16,16,16,16,16,16,16,16,16]   //14
//    var judIndexs41:[Int] = [1,3,7,4,10]
//    var allcmds:[String] = ["00","00","D1E00009","D1E00009","D1E00009","D1E00009","D1E00009","D1E00009","D1E00009","D1E00009","D1E00009","D1E00009","D1E00009","D1E00009","D1E00009"] //命令数组

    public int getCountx() {
        return seqArray.length;
    }


    public static void setfeeds() {



      // String[] feedDArrayx = new String[]{"0071", "0072", "0073", "0074",
       //        "0081", "0082", "0083", "0084","0085","0086","0087","1010","1011","71b0","72b0","73b0","74b0"};
     //{"0071", "0072", "0073", "0074","0075","0076","0081", "0082", "0099", "0099","0099","0086","0087",
        // "1010","1011","1010","1011","71b0","72b0","73b0","74b0"};
//1010 1011 voltage  "71b0","72b0","73b0","74b0" slider
         String[] feedDArrayx = new String[]{"0071", "0072", "0073", "0074",
                "0099", "0099", "0099","0099", "0081", "0082", "0083", "1010","1011","71b0"};

       //  {"0071", "0072", "0073", "0074","0081", "0082","0086","0087",
       //   "1010","1011","71b0","72b0","73b0","74b0"};
        String[] feedDTypex = new String[]{"1", "1", "1", "1", "9","9","9","9",
                "1", "1", "1",
                "2","2","6"};
     //   String[] feedDTypex = new String[]{"1", "1", "1", "1",
     //           "1","1","9", "9","9", "1","1",
     //           "2","2","6","6","6","6"};
        setfeedinit(feedDArrayx,feedDTypex);

       // String[] feedDArrayx0 = new String[]{"", "", "", "0081", "0082", "0083", "0084","0085","0086","0087"};
       // setfeedinit(feedDArrayx0);


    }

    public static void setfeedinit(String[] myDArrayx,String[] myDArray)
    {
        int vv = myDArrayx.length;
        for (int x=0; x<vv; x++) {
            if(!myDArrayx[x].equals("")) {
                feedMap.put(myDArrayx[x],"0000");
                feedType.put(myDArrayx[x],myDArray[x]);

            }
        }
    }

    public void s0() {
        pageno = 0;
        pageback = R.drawable.a1;
        jmpPosition = 0;
        seqArray = new Integer[]{1, 2, 3, 4, 5, 6,7,8,9,10,11};
        typeArray = new Integer[]{20, 20, 20, 19, 19, 19, 19, 19, 19,19,19};
//        cmdArray = new String[]{"0","1","2","71E00000","72E00000",
//                "73E00000",
//                "74E00000",
//                "75E00000",
//                "76E00000"};
        cmdArray = new String[]{"0","1","2","71E00000","72E00000", "73E00000", "74E00000",
                "75E00000", "76E00000", "77E00000", "78E00000",
        };
//        feedDArray = new String[]{"", "", "", "","", "", "00d1", "0002","0072"};
//        cmdArray = new String[]{"0","1","2","71E00000","72E00000",
//                "73E00000",
//                "74E00000",
//                "75E00000",
//                "76E00000"};
        nodeArray = new Integer[]{1, 1, 1, 0, 0, 0, 0, 0, 0,0,0};
        feedDArray = new String[]{"", "", "", "0071", "0072", "0073", "0074","","","",""};

        offArray = new Integer[]{R.drawable.b1_off, R.drawable.b2_off, R.drawable.b3_off,
                R.drawable.b1_off, R.drawable.b2_off, R.drawable.b3_off, R.drawable.b4_off,
                R.drawable.b5_off, R.drawable.b6_off,R.drawable.b7_off, R.drawable.b8_off};

        onArray = new Integer[]{R.drawable.b1_on, R.drawable.b2_on, R.drawable.b3_on,
                R.drawable.b1_on, R.drawable.b2_on, R.drawable.b3_on, R.drawable.b4_on,
                R.drawable.b5_on, R.drawable.b6_on,R.drawable.b7_on, R.drawable.b8_on};

        // Rect[] allRect = {};
        // Rect curRect;

//        int mleft = 1204;
//        int mtop = 600;
//        int mwidth = 144;
//        int mheight = 145;
//
//        curRect = new Rect(mleft, mtop, mwidth, mheight);
        allRect = new Rect[11];
        allRect[0] = new Rect(290, 482, 290 + 190, 482 + 160);
        allRect[1] = new Rect(462, 482, 462 + 190, 482 + 160);
        allRect[2] = new Rect(634, 482, 634 + 190, 482 + 160);
        allRect[3] = new Rect(241, 68, 241 + 91, 68 + 91);
        allRect[4] = new Rect(391, 68, 391 + 91, 68 + 91);
        allRect[5] = new Rect(541, 68, 541 + 91, 68 + 91);
        allRect[6] = new Rect(691, 68, 691  + 91, 68 + 91);
        allRect[7] = new Rect(359, 278, 359 + 100, 278 + 23);
        allRect[8] = new Rect(463, 278, 463 + 100, 278 + 23);
        allRect[9] = new Rect(567, 278, 567  + 100, 278 + 23);
        allRect[10] = new Rect(671, 278, 671 + 100, 278 + 23);

        // setfeedinit();
        // allRect = allRect0;

        //   for (Rect rect : allRect = allRect0) {
        // setfeedinit(feedDArray);
    }

//    public void s0o() {
//        pageno = 0;
//        pageback = R.drawable.a1;
//        jmpPosition = 1;
//        seqArray = new Integer[]{1, 2, 3, 4, 5,6,7};
//        typeArray = new Integer[]{20, 20, 20, 19, 19, 19, 19};
////        cmdArray = new String[]{"0","1","2","71E00000","72E00000",
////                "73E00000",
////                "74E00000",
////                "75E00000",
////                "76E00000"};
//        cmdArray = new String[]{"0","1","2","71E00000","72E00000",
//                "73E00000",
//                "74E00000"};
////        feedDArray = new String[]{"", "", "", "","", "", "00d1", "0002","0072"};
////        cmdArray = new String[]{"0","1","2","71E00000","72E00000",
////                "73E00000",
////                "74E00000",
////                "75E00000",
////                "76E00000"};
//        nodeArray = new Integer[]{1, 1, 1, 0, 0, 0,0};
//        feedDArray = new String[]{"", "", "", "0071", "0072", "0073", "0074"};
//
//        offArray = new Integer[]{R.drawable.b1_off,
//                R.drawable.b2_off, R.drawable.b3_off, R.drawable.b1_off,
//                R.drawable.b2_off, R.drawable.b3_off, R.drawable.b4_off};
//
//        onArray = new Integer[]{R.drawable.b1_on,
//                R.drawable.b2_on, R.drawable.b3_on,R.drawable.b1_on,
//                R.drawable.b2_on, R.drawable.b3_on, R.drawable.b4_on};
//
//        // Rect[] allRect = {};
//        // Rect curRect;
//
////        int mleft = 1204;
////        int mtop = 600;
////        int mwidth = 144;
////        int mheight = 145;
////
////        curRect = new Rect(mleft, mtop, mwidth, mheight);
//        allRect = new Rect[7];
//        allRect[0] = new Rect(290, 482, 290 + 190, 482 + 160);
//        allRect[1] = new Rect(462, 482, 462 + 190, 482 + 160);
//        allRect[2] = new Rect(634, 482, 634 + 190, 482 + 160);
//        allRect[3] = new Rect(151, 134, 151 + 91, 134 + 91);
//        allRect[4] = new Rect(317, 134, 317 + 91, 134 + 91);
//        allRect[5] = new Rect(151, 278, 151 + 91, 278 + 91);
//        allRect[6] = new Rect(317, 278, 317  + 91, 278 + 91);
////        allRect[7] = new Rect(242, 267, 242 + 91, 267 + 91);
////        allRect[8] = new Rect(406, 267, 406 + 91, 267 + 91);
//        // setfeedinit();
//        // allRect = allRect0;
//
//        //   for (Rect rect : allRect = allRect0) {
//        // setfeedinit(feedDArray);
//    }


    public void s1() {
        pageno = 1;
        pageback = R.drawable.a3;
       jmpPosition = 1;


        seqArray = new Integer[]{1, 2, 3, 4, 5, 6};

        cmdArray = new String[]{"0","1","2",
                "81100000","82100000", "83200000",
        };
        //  feedDArray = new String[]{"", "", "", "0081", "0082", "0083", "0084","0085","0086","0087"};
        feedDArray = new String[]{"", "", "", "0081", "0082", "0083"};
        nodeArray = new Integer[]{1, 1, 1, 0,0, 0};
        typeArray = new Integer[]{20, 20, 20, 19, 19, 19};

        offArray = new Integer[]{R.drawable.c1_off, R.drawable.c2_off, R.drawable.c3_off,
                R.drawable.c1_off, R.drawable.c2_off, R.drawable.c3_off};

        onArray = new Integer[]{R.drawable.c1_on, R.drawable.c2_on, R.drawable.c3_on,
                R.drawable.c1_on, R.drawable.c2_on, R.drawable.c3_on};
//        offArray = new Integer[]{R.drawable.b1_off, R.drawable.b2_off, R.drawable.b3_off, R.drawable.b1_off,R.drawable.b2_off,
//                R.drawable.b3_off,R.drawable.b4_off,R.drawable.c5_off,R.drawable.c6_off,R.drawable.c7_off};
//
//        onArray = new Integer[]{ R.drawable.c1_on,R.drawable.c2_on,
//                R.drawable.c3_on,R.drawable.b1_on,R.drawable.b2_on,  R.drawable.b3_on,R.drawable.b4_on,
//                R.drawable.c3_on,R.drawable.c4_on,R.drawable.c5_on,R.drawable.c6_on,R.drawable.c7_on};

        // Rect[] allRect = {};
        // Rect curRect;

//        int mleft = 1204;
//        int mtop = 600;
//        int mwidth = 144;
//        int mheight = 145;
//
//        curRect = new Rect(mleft, mtop, mwidth, mheight);
        allRect = null;
        allRect = new Rect[6];
        allRect[0] = new Rect(290, 482, 290 + 190, 482 + 160);
        allRect[1] = new Rect(462, 482, 462 + 190, 482 + 160);
        allRect[2] = new Rect(634, 482, 634 + 190, 482 + 160);
        allRect[3] = new Rect(300, 210, 300 + 91, 210 + 91);
        allRect[4] = new Rect(467, 210, 467 + 91, 210 + 91);
        allRect[5] = new Rect(632, 210, 632 + 91, 210 + 91);
      //  allRect[6] = new Rect(715, 212, 715 + 91, 212 + 91);
  //      allRect[7] = new Rect(385, 276, 385 + 91, 276 + 91);
//        allRect[8] = new Rect(550, 276, 550 + 91, 276 + 91);
//        allRect[9] = new Rect(715, 276, 715 + 91, 276 + 91);
//        allRect[10] = new Rect(715, 276, 715 + 91, 276 + 91);
       // setfeedinit();
       // setfeedinit(feedDArray);
    }




    public void s2() {
        pageno = 2;
        pageback = R.drawable.a2;
        jmpPosition = 2;

        seqArray = new Integer[]{1, 2, 3};
        cmdArray = new String[]{"0","1","2"};
        feedDArray = new String[]{"", "", ""};
       // feedStatus = new String[]{"", "", "", "","", "", "0001", "0002","0072"}; //仅本页有效
        nodeArray = new Integer[]{1, 1, 1};
        typeArray = new Integer[]{20, 20, 20,}; //20 19 16 16 command 25 not
        offArray = new Integer[]{R.drawable.c1_off, R.drawable.c2_off, R.drawable.c3_off};

        onArray = new Integer[]{R.drawable.c1_on, R.drawable.c2_on, R.drawable.c3_on, };

        allRect = new Rect[3];
        allRect[0] = new Rect(290, 482, 290 + 190, 482 + 160);
        allRect[1] = new Rect(462, 482, 462 + 190, 482 + 160);
        allRect[2] = new Rect(634, 482, 634 + 190, 482 + 160);


        //反馈状态初始化显示
        //根绝接收的反馈信息变换状态

       //setfeedinit(feedDArray);
       // setfeedinit();
    }


    public void setInit(int currentPage) {

        switch (currentPage) {
            case 0:
                s0();
                break;
            case 1:
                s1();
                break;
            case  2:
                s2();
                break;
            default:
                break;
        }
    }


    //int mRes = R.drawable.vido_2_on;
    //   mezi.setClickable(true);
    // tempRect = new Rect(rconvertW(mezi.mleft) , r  mezi.mtop), rconvertW(mezi.mleft + mezi.mwidth) ,r  mezi.mtop + mezi.mheight));
    //tempRect = new Rect(mezi.mleft , mezi.mtop, mezi.mleft + mezi.mwidth ,mezi.mtop + mezi.mheight);


//    func SendTime(){
//        let nowdate = Date()
//        let dateFormatter  = DateFormatter()
//        dateFormatter.dateFormat = "HH:mm:ss"
//        let timeString  =  dateFormatter.string(from: nowdate)
//        let  hh:String  = (timeString as NSString).substring(with: NSMakeRange(0, 2))
//        let  mm:String = (timeString as NSString).substring(with: NSMakeRange(3, 2))
//        let  ss:String = (timeString as NSString).substring(with: NSMakeRange(6, 2))
//        var sendCommandttStr :  String = "5AA508883F3F" + hh +  mm + ss + "3ee3"
//        appDelegate().sendMessage(sendCommandttStr)
//    }
//
//
//    func s0feed()
//    {
//        var txx:[CGFloat] = [(CGFloat)(mywidth) * 133 / swidth,
//            (CGFloat)(mywidth) * 752 / swidth,
//            (CGFloat)(mywidth) * 1139 / swidth,
//            (CGFloat)(mywidth) * 1760 / swidth]
//
//        var tyy:[CGFloat] = [
//        (CGFloat)(myheight) * 659 / sheight,
//                (CGFloat)(myheight) * 659 / sheight,
//                (CGFloat)(myheight) * 659 / sheight,
//                (CGFloat)(myheight) * 659 / sheight]
//
//        var tww:[CGFloat] = [(CGFloat)(mywidth) * 173 / swidth,
//            (CGFloat)(mywidth) * 173 / swidth,
//            (CGFloat)(mywidth) * 173 / swidth,
//            (CGFloat)(mywidth) * 173 / swidth]
//
//        var thh:[CGFloat] = [(CGFloat)(myheight) * 150 / sheight,
//            (CGFloat)(myheight) * 150 / sheight,
//            (CGFloat)(myheight) * 150 / sheight,
//            (CGFloat)(myheight) * 150 / sheight]
//
//        var ttis:[String] = ["1","2", "3", "4"]
//        let judbtn:[Int] = [19,19,19,19]
//        var scmd : [String] = ["91202001","92202001","93202001","94202001"]
//
//        var onImage:[String] = ["gds_on","wh_on","gdj_on","dss_on"]
//
//        var offImage:[String] = ["gds_off","wh_off","gdj_off","dss_off"]
//
//        var defAddr:[String] = ["00E1","00C3","00E2","00E1","00C3","00E2","00E1","00C3","0000","0000"]
//
//        let tmp = judbtn.count - 1
//        for topIndex in 0...tmp{
//
//        let fbtnframe   = CGRect(x:txx[topIndex],y:tyy[topIndex],width:tww[topIndex],height:thh[topIndex])
//        let tswitchbtn = mButton(frame:fbtnframe)
//        tswitchbtn.judge = judbtn[topIndex]
//        tswitchbtn.backgroundColor = normal
//        tswitchbtn.cmd = scmd[topIndex]
//        self.view.addSubview(tswitchbtn)
//        tswitchbtn.isUserInteractionEnabled = true
//        tswitchbtn.addTarget(self, action:#selector(homeViewController.change(_:)), for: .touchUpInside)
//
//        self.view.addSubview(tswitchbtn)
//        self.feedbtns.append(tswitchbtn)
//        if(judbtn[topIndex] == 19){
//            let tbtnframe   = CGRect(x:txx[topIndex],y:tyy[topIndex],width:tww[topIndex],height:thh[topIndex])
//            let tswitchbtn = mButton(frame:tbtnframe)
//            //  tswitchbtn.backgroundColor = UIColor.brown
//            tswitchbtn.setBackgroundImage(UIImage(named: offImage[topIndex]), for: UIControlState())
//            // tswitchbtn.setTitle(ttis[topIndex], for: .normal)
//            tswitchbtn.judge = judbtn[topIndex]
//            tswitchbtn.cmd = scmd[topIndex]
//
//            self.view.addSubview(tswitchbtn)
//            //self.feedbtns.append(tswitchbtn)
//            //self.view.bringSubview(toFront: swi)
//            //  self.view.isUserInteractionEnabled = false
//            tswitchbtn.isUserInteractionEnabled = true
//            tswitchbtn.addTarget(self, action:#selector(homeViewController.changed(_:)), for: .touchDown)
//            tswitchbtn.addTarget(self, action:#selector(homeViewController.change(_:)), for: .touchUpInside)
//            //self.feedbtns.append(tswitchbtn)
//        }
//
//    }
//        //19 diandong chili
//        let tmpf = judbtn.count - 1
//        for topIndey in 0...tmpf{
//        if(judbtn[topIndey] == 16){
//            var feedxx = false
//            {
//                willSet(newValue)
//                {
//                    if newValue
//                    {
//                        self.feedbtns[topIndey].setBackgroundImage(UIImage(named: onImage[topIndey]), for: UIControlState())
//
//
//                    }
//                        else
//                    {
//                        self.feedbtns[topIndey].setBackgroundImage(UIImage(named: offImage[topIndey]), for: UIControlState())
//                    }
//                }
//            }
//            feedxx = false
//            feedxx = (defaults.string(forKey:defAddr[topIndey]) == "0001") ? true : false
//
//        }
//    }
//
//    }


//    func s0() //s0 home
//    {
//        addnew(xx: self.view)
//        // displayTime()
//        //var myDate1 = getTimesx()
//        //447 1123 447 1123
//        //253 880 h
//        //563
//        let x1:CGFloat = (CGFloat)(mywidth) * 110.0 / swidth
//        let x2:CGFloat =   (CGFloat)(mywidth) * 455.0 / swidth
//        let x3:CGFloat = (CGFloat)(mywidth) * 764.0 / swidth
//        let x4:CGFloat = (CGFloat)(mywidth) * 1081.0 / swidth
//        let x5:CGFloat = (CGFloat)(mywidth) * 1395.0 / swidth
//        let x6:CGFloat = (CGFloat)(mywidth) * 1707.0 / swidth
//
//        var xx:[CGFloat] = [x1 , x2 , x3,x4,x5,x6]
//        //(CGFloat)(myheight) * 7.91/25.96
//        var yy:[CGFloat] = [(CGFloat)(myheight) * 1235.0 / sheight,(CGFloat)(myheight) * 1277.0 / sheight ,(CGFloat)(myheight) *  1277.0 / sheight,(CGFloat)(myheight) * 1277 / sheight,(CGFloat)(myheight) * 1277 / sheight,(CGFloat)(myheight) * 1277 / sheight]
//        //(CGFloat)(myheight) * 7.33/25.96
//
//        var ww:[CGFloat] = [(CGFloat)(mywidth) * 272.0 / swidth, (CGFloat)(mywidth) * 194.0 / swidth, (CGFloat)(mywidth) * 194.0 / swidth,(CGFloat)(mywidth) * 194.0 / swidth, (CGFloat)(mywidth) * 194.0 / swidth,(CGFloat)(mywidth) * 194.0 / swidth]
//
//        //(CGFloat)(myheight) * 1.49/25.96
//        var hh:[CGFloat] = [(CGFloat)(myheight) * 248 / sheight,(CGFloat)(myheight) * 178.0 / sheight,(CGFloat)(myheight) * 178.0 / sheight,(CGFloat)(myheight) * 178.0 / sheight,(CGFloat)(myheight) * 178.0 / sheight,(CGFloat)(myheight) * 178.0 / sheight]
//
//        let bx1:CGFloat = (CGFloat)(mywidth) * 283.0 / swidth
//        let bx2:CGFloat =   (CGFloat)(mywidth) * 609.0 / swidth
//        let bx3:CGFloat = (CGFloat)(mywidth) * 901.0 / swidth
//        let bx4:CGFloat = (CGFloat)(mywidth) * 1261.0 / swidth
//        let bx5:CGFloat = (CGFloat)(mywidth) * 1581.0/swidth
//
//        var bxx:[CGFloat] = [bx1 , bx2 , bx3,bx4,bx5]
//        //(CGFloat)(myheight) * 7.91/25.96
//        var byy:[CGFloat] = [(CGFloat)(myheight) * 1286.0 / sheight,(CGFloat)(myheight) * 1286.0 / sheight ,(CGFloat)(myheight) *  1253.0 / sheight,(CGFloat)(myheight) * 1286.0 / sheight,(CGFloat)(myheight) * 1286.0/sheight]
//        //(CGFloat)(myheight) * 7.33/25.96
//        var bww:[CGFloat] = [(CGFloat)(mywidth) * 175.0 / swidth, (CGFloat)(mywidth) * 175.0 / swidth, (CGFloat)(mywidth) * 256.0 / swidth,(CGFloat)(mywidth) * 175.0 / swidth, (CGFloat)(mywidth) * 175/swidth]
//
//        //(CGFloat)(myheight) * 1.49/25.96
//        var bhh:[CGFloat] = [(CGFloat)(myheight) * 215.0 / sheight,(CGFloat)(myheight) * 215.0 / sheight,(CGFloat)(myheight) * 256.0 / sheight,(CGFloat)(myheight) * 215.0 / sheight,(CGFloat)(myheight) * 215/sheight]
//        var tis:[String] = ["A","B","C","D","E"]
//
//        let statusoff:[String] = ["homepage_seat_off","homepage_light_off","homepage_media_off","homepage_power_off"]
//        let statuson:[String] = ["homepage_seat_on","homepage_light_on","homepage_media_on","homepage_power_on"]
//        for botIndex in 0...5 //5
//        {
//            let btnframe   = CGRect(x:xx[botIndex],y:yy[botIndex],width:ww[botIndex],height:hh[botIndex])
//
//            let switchbtn = mButton(frame:btnframe)
//            // switchbtn.setBackgroundImage(UIImage(named:statusoff[botIndex]), for: .normal)
//            // switchbtn.setBackgroundImage(UIImage(named:statuson[botIndex]), for: .selected)
//
//            // switchbtn.backgroundColor = UIColor.red
//            //  switchbtn.setTitle(tis[botIndex], for: .normal)
//
//            self.view.addSubview(switchbtn)
//            //self.view.bringSubview(toFront: swi)
//            //  self.view.isUserInteractionEnabled = false
//            switchbtn.isUserInteractionEnabled = true
//            //  switchbtn.addTarget(self, action:#selector(homeViewController.changed(_:)), for: .touchDown)
//            if(botIndex != 0)
//            {
//                switchbtn.addTarget(self, action:#selector(homeViewController.change(_:)), for: .touchUpInside)
//            }
//            switchbtn.current = currentIndex
//            switchbtn.judge = judIndexs0[botIndex] //[1,3,7,10,4]
//            bottombtns.append(switchbtn)
//
//        }
//
//        let tx1:CGFloat = (CGFloat)(mywidth) * 9.75/34.68
//        let tx2:CGFloat =   (CGFloat)(mywidth) * 17.37/34.68
//        let tx3:CGFloat = (CGFloat)(mywidth) * 24.69/34.68
//
//        var txx:[CGFloat] = [x1 , x2 , x3]
//        //(CGFloat)(myheight) * 7.91/25.96
//        var tyy:[CGFloat] = [(CGFloat)(myheight) * 7.91/25.96,(CGFloat)(myheight) * 7.91/25.96,(CGFloat)(myheight) * 7.91/25.96]
//        //(CGFloat)(myheight) * 7.33/25.96
//        var tww:[CGFloat] = [(CGFloat)(mywidth) * 7.62/34.68, (CGFloat)(mywidth) * 7.32/34.68, (CGFloat)(mywidth) * 7.60/34.68]
//
//        //(CGFloat)(myheight) * 1.49/25.96
//        var thh:[CGFloat] = [(CGFloat)(myheight) * 1.49/25.96,(CGFloat)(myheight) * 1.49/25.96,(CGFloat)(myheight) * 1.49/25.96]
//        var ttis:[String] = ["A","B","C"]
//
//        let rbtnframe   = CGRect(x:(CGFloat)(mywidth) * 1835/2048,y:(CGFloat)(myheight) * 1343/1530,width:(CGFloat)(mywidth) * 152/2048,height:(CGFloat)(myheight) * 152/1530)
//        voiceButton = mButton(frame:rbtnframe)
//        // voiceButton?.isHidden = true
//        voiceButton?.isUserInteractionEnabled = true
//        self.voiceButton?.setBackgroundImage(UIImage(named: "homepage_voicecontrol_off"),for: .normal)
//        // self.voiceButton?.setImage(UIImage(named: "homepage_voicecontrol_off"), for: UIControlState())
//        voiceButton?.addTarget(self, action:#selector(homeViewController.startRecord(_:)), for: .touchUpInside)
//
//        //  feedmainseat()
//
//
//
//        if first == 1 {
//        SendTime()
//
//    }
//        first = 0
//
//        s0feed();
//    }




}

